import 'package:core_package/share/my_color.dart';
import 'package:core_package/share/my_font.dart';
import 'package:core_package/share/my_font_weight.dart';
import 'package:flutter/material.dart';

class MyButton extends StatelessWidget {
  final String? title;
  final double width;
  final double height;
  final double radius;
  final Color? color;
  final TextStyle? titleStyle;
  final Function()? onTap;

  const MyButton({
    Key? key,
    @required this.title,
    this.width = 200,
    this.height = 40,
    this.radius = 3,
    this.color,
    this.titleStyle,
    this.onTap,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      behavior: HitTestBehavior.opaque,
      onTap: () {
        if (onTap != null) {
          onTap?.call();
        }
      },
      child: Container(
        width: width,
        height: height,
        decoration: BoxDecoration(
          color: color ?? MyColors.color_245_174_41,
          borderRadius: BorderRadius.circular(radius),
        ),
        alignment: Alignment.center,
        child: Text(
          title ?? '',
          style: titleStyle ??
              TextStyle(
                color: Colors.white,
                fontSize: MyFont.font14,
                fontWeight: MyFontWeight.bold,
              ),
        ),
      ),
    );
  }
}
